package com.gtw.modules.api.controller;


import com.gtw.common.annotation.LoginUserApi;
import com.gtw.common.utils.R;
import com.gtw.modules.api.service.TbFeedbackServices;
import com.gtw.modules.entity.TbFeedback;
import com.gtw.modules.entity.TbLike;
import com.gtw.modules.entity.TbUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 意见反馈
 */
@RestController
@RequestMapping("/api/feedback")
public class TbFeedbackController {

    @Autowired
    private TbFeedbackServices tbFeedbackServices;


    /**
     * 提交反馈
     *
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public R add(@LoginUserApi TbUser tbUser, String content, String phone) {
        TbFeedback tbFeedback = new TbFeedback();
        tbFeedback.setContent(content);
        tbFeedback.setCreatedate(new Date());
        tbFeedback.setStatus(false);
        tbFeedback.setUid(tbUser.getUuid());
        tbFeedback.setPhone(phone);
        tbFeedbackServices.insert(tbFeedback);
        return R.ok();
    }

}
